refactor(graphql): migrate internal marker decorators to auto decorators - #105
Merged
FionaBronwen merged 5 commits intoJul 15, 2026
Conversation
Convert the internal `@nullable`, `@nullableElements`, `@oneOf`, and
`@inputType` marker decorators from hand-written implementations (and the
`.decorators`-push hack) to compiler `internal auto dec` declarations.
- Adopt tspd `gen-extern-signature` generated readers/setters (isNullable,
setNullable, isOneOf, setOneOf, isInputType, setInputType, ...) instead of
hand-written state accessors; delete src/lib/{nullable,one-of,input-type}.ts.
- Type all decorator implementations with the generated `*Decorator`
signatures; `$decorators` uses `satisfies TypeSpecGraphQLDecorators`.
- Wire up gen-extern-signature into the build; add generated-defs/ and
tspconfig.yaml (auto-decorators experimental feature opt-in).
- Remove now-unused GraphQLKeys state entries for the migrated decorators.
FionaBronwen
approved these changes
Jul 15, 2026
FionaBronwen
marked this pull request as ready for review
July 15, 2026 18:31
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Migrates the GraphQL library's internal marker decorators from hand-written implementations to compiler
internal auto decdeclarations, and adopts the tspdgen-extern-signaturegenerated accessors + decorator signature types.Decorators converted to
internal auto dec:@nullable@nullableElements@oneOf— was still using the.decorators-push hack (model.decorators.push(...)/.some(...))@inputType— was an internal-onlyuseStateSetmarker whose$inputTypedecorator fn was dead (never registered)Why
These decorators just mark a type; they store no meaningful data and had no validation/transform logic. Previously the emitter located them via
.decoratorsscanning or bespoke state helpers.auto declets the compiler synthesize the implementation and lets tspd generate strongly-typedis*/set*accessors, removing hand-written state plumbing.Changes
lib/{nullable,one-of,input-type}.tsp:internal auto decdeclarations (addedinput-type.tsp, wired intomain.tsp).src/lib/{nullable,one-of,input-type}.ts— replaced by generatedgenerated-defs/TypeSpec.GraphQL.tsaccessors (isNullable/setNullable,isOneOf/setOneOf,isInputType/setInputType, ...).*Decoratorsignatures;$decoratorsusessatisfies TypeSpecGraphQLDecorators.gen-extern-signature; addedtspconfig.yamlopting into theauto-decoratorsexperimental feature.GraphQLKeysstate entries.Decorators intentionally left as-is
@compose,@operationFields,@schema,@graphqlInterface,@mutation/@query/@subscription,@specifiedBy— these carry validation / accumulation / transform logic that auto decorators can't express.Note
This branch includes the merge of
microsoft/mainwhich brings thesetAutoDecoratorcompiler API + tspd setter generation (microsoft#11247) that this refactor depends on.pinterest/feature/graphqlwas exactly 1 commit behind main (that PR), so the diff surfaces those changes too.All 368
@typespec/graphqltests pass; lint + prettier clean.